const {
  bookList
} = require("./mock");


module.exports = {
  devServer: {
    before(app) {
      app.get('/api/booklist', (req, res) => {
        res.json(bookList)
      });

      app.get('/api/book', (req, res) => {
        let {
          id
        } = req.query;

        res.json(bookList.list.find((item) =>
          item.id == id
        ));

      })
    }
  }
}